package com.hh.exception;

import com.hh.commonutils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ControllerAdvice
public class GloableExceptionHander {
    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result fail(Exception e){
        return Result.fail().data("msg",e.getMessage());
    }

    @ExceptionHandler(ManException.class)
    @ResponseBody
    public Result ManExceptionFail(Exception e){
        return Result.fail();
    }
}
